<template>
  <div>
      <to-search></to-search>
         <van-card
         @click="$router.push({name:'详情',params:{id: item.id}})"
         v-for="item in arr" :key="item.id"
          :price="item.price"
          :title="item.goodsname"
          :thumb="$pre + item.img"
             />

      <van-empty v-if="arr.length == 0" description="暂无数据" />
  </div>
</template>

<script>
import { Empty } from 'vant'
import axios from "axios"
import {reqlist} from "../../http/http"
export default {
  data() {
    return{
      //1 初始值
      arr:[],
    }
  },
   mounted(){
    //2 请求数据
    reqlist({cateid:this.$route.query.id,
        type:1}).then((res)=>{
      console.log(res);
      this.arr = res.data.list.goodData ? res.data.list.goodData :[];
    })
   }
}
</script>

<style>

</style>